// Copyright (C) <2018> Zealcomm Inc.
//
// SPDX-License-Identifier: Apache-2.0
#ifndef IRTC_BASE_OBJC_IRTCSTREAM_H_
#define IRTC_BASE_OBJC_IRTCSTREAM_H_

#import <Foundation/Foundation.h>
#import <IRTC/IRTCMacros.h>
#import <IRTC/IRTCMediaRenderer.h>
NS_ASSUME_NONNULL_BEGIN
@class IRTCStreamMediaInfo;
@class IRTCVideoRenderer;
@class IRTCAudioRenderer;
@class IRTCMediaRenderer;

/// Base class of all streams in the SDK<br>SDK的所有媒体流的基类。
IRTC_OBJC_EXPORT
@interface IRTCStream : NSObject
// Writable because mediaStream is subscribed after IRTCRemoteStream is created
// in conference mode.

@property(nonatomic, strong, readonly) IRTCStreamMediaInfo* mediaInfo;
- (instancetype)init /*NS_UNAVAILABLE*/;

/**
  Get stream's ID<br>获取流的ID。
*/
@property(nonatomic, strong, readonly) NSString* streamId;

/**
  @brief Attach the stream's first video and audio track to a renderer in order
  to record
  file.<br>将媒体流的第一条视频轨和音频轨绑定到渲染器上来录制媒体文件。
 */
- (void)attachMedia:(id<IRTCMediaRenderer>)renderer;

/**
  @brief Attach the stream's first video track to a
  renderer.<br>将媒体流的第一条视频轨绑定到渲染器上。
 */
- (void)attach:(id<IRTCVideoRenderer>)renderer;

/**
  @brief Attach the stream's first video track to a
  renderer.<br>将媒体流的第一条视频轨绑定到渲染器上。
 */
- (void)attachVideo:(id<IRTCVideoRenderer>)renderer;

/**
  @brief Attach the stream's first audio track to a
  renderer.<br>将媒体流的第一条音频轨绑定到渲染器上。
 */
- (void)attachAudio:(id<IRTCAudioRenderer>)renderer;

/**
  @brief Detach the stream's first video and audio track to a
  renderer.<br>将媒体流的第一条视频轨和音频轨从渲染器上解绑。
 */
- (void)detachMedia:(id<IRTCMediaRenderer>)renderer;

/**
  @brief Detach the stream's first video track to a
  renderer.<br>将媒体流的第一条视频轨从渲染器上解绑。
 */
- (void)detach:(id<IRTCVideoRenderer>)renderer;

/**
  @brief Detach the stream's first video track to a
  renderer.<br>将媒体流的第一条视频轨从渲染器上解绑。
 */
- (void)detachVideo:(id<IRTCVideoRenderer>)renderer;

/**
  @brief Detach the stream's first audio track to a
  renderer.<br>将媒体流的第一条音频轨从渲染器上解绑。
 */
- (void)detachAudio:(id<IRTCAudioRenderer>)renderer;

/**
  @brief Capture the stream's current image.<br>截图媒体流当前画面的截图。
 */
- (void)capture:(void (^)(UIImage*))onSuccess
      onFailure:(void (^)(NSError*))onFailure;

/**
  @brief Whether this Stream has an audio track.<br>当前媒体流是否有音频轨。
  @return Return true if it has an audio track; otherwise,
  false.<br>如果有音频轨返回true，否则false。
*/
- (BOOL)hasAudio;

/**
  @brief Whether this Stream has a video track.<br>当前媒体流是否有视频轨。
  @return Return true if it has a video track; otherwise,
  false.<br>如果有视频轨返回true，否则false。
*/
- (BOOL)hasVideo;

/**
  @brief Disable the stream's first audio track.<br>将媒体流的第一条音频暂停。
 */
- (void)disableAudio;

/**
  @brief Enable the stream's first audio track.<br>将媒体流的第一条音频恢复。
 */
- (void)enableAudio;

/**
  @brief Disable the stream's first video track.<br>将媒体流的第一条视频暂停。
 */
- (void)disableVideo;

/**
  @brief Enable the stream's first video track.<br>将媒体流的第一条视频恢复。
 */
- (void)enableVideo;

/**
  @brief Returns a user-defined attribute
  dictionary.<br>返回用户定义的属性字典。
  @details These attributes are defined by
  publisher.<br>这些属性是发布者定义的。
*/
- (NSDictionary<NSString*, NSString*>*)attributes;
@end
NS_ASSUME_NONNULL_END
#endif  // IRTC_BASE_OBJC_IRTCSTREAM_H_